import {getSearchListRequest} from '@/api'

const state={
    //数据里面是一个对象，包含三个数组
    searchList:{}
}
const mutations={
    GET_SEARCHLIST_SET(state,value){
        state.searchList = value
    }
}

const actions={
    async getSearchList({commit},searchParams){
        const re = await getSearchListRequest(searchParams)
        commit('GET_SEARCHLIST_SET',re)
    }
}

const getters={
    //poetman测试请求是对象包含三个数组的数据
    // 使用gertters计算属性，分别拿到每个数据
    trademarkList(state){
        return state.searchList.trademarkList
    },
    attrsList(state){
        return state.searchList.attrsList
    },
    goodsList(state){
        return state.searchList.goodsList
    }
}


export default { 
    namespaced:true,
    state, 
    mutations, 
    actions, 
    getters }